package org.darkforest.enums;

/**
 * Created by Administrator on 2015/11/9.
 * 会员等级
 */
public enum MemberLevel {
    LEVEL_1(1,"普通会员"),LEVEL_2(2,"VIP会员"),LEVEL_3(3,"白金会员"),
    LEVEL_4(4,"钻石会员"),LEVEL_5(5,"网店会员"),LEVEL_6(6,"代理网店"),
    LEVEL_7(7,"供货网店"),LEVEL_8(8,"供货企业");


    private int level;
    private String levelName;

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public String getLevelName() {
        return levelName;
    }

    public void setLevelName(String levelName) {
        this.levelName = levelName;
    }

    private MemberLevel(int level, String levelName) {
        this.level = level;
        this.levelName = levelName;
    }

//    /**
//     * 通过级别获取级别名称
//     * @param level
//     * @return
//     */
//    public static String getByValue(int level){
//        for(MemberLevel e : MemberLevel.values()){
//            if(e.level == level){
//                return e.getLevelName();
//            }
//        }
//        return null;
//    }

    /**
     * 通过级别获取级别名称
     * @param level
     * @return
     */
    public static String getByValue(int level){
        for(MemberLevel e : MemberLevel.values()){
            if(e.level == level){
                return e.getLevelName();
            }
        }
        return null;
    }

}
